home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230D / TSCRIPT.DOC < prev   
Encoding:
Text File  |  1995-06-16  |  15.3 KB  |  260 lines

  1.                 INFORMATION SERVERS AND TSCRIPT 
  2.  
  3. One of the new, unique features of TNOS is the Information Servers. These
  4. are Hypertext drivers that allows tutorials, help systems, on-line surveys,
  5. etc. to be easily added to the BBS. The whole process is driven by a
  6. standard ASCII script file. The TNOS scripting language is named TScript,
  7. and is used for many features throughout TNOS.
  8.  
  9. Within TScript, all lines that begin with a '~' are control lines.
  10. All other lines are simply data. Special Text Control Sequences can be
  11. contained within a data line, allowing easy customization.
  12.  
  13. This message will serve to wet your appetite and also to document the
  14. file format until better documentation is available.
  15.  
  16.  
  17. INFORMATION SERVER SCRIPT FILENAMES:
  18. Who cares! The user never sees them, they see the description from the
  19. file's title line, and a number to use to choose the entry. The file
  20. must be in the spool/TUTOR, spool/NEWS, or spool/INFO sub-directories,
  21. depending on whether your wish this to be a general tutorial, a news item,
  22. or an information source. The file MUST have a ".tut" file extension to be
  23. displayed as a part of one of the Information Server menus.
  24.  
  25. When using TScript outside of the Information Servers, the filename has
  26. no restrictions at all.
  27.  
  28.  
  29. TSCRIPT TITLE LINE:
  30. The first non-blank line of the TScript file is special! It serves to provide
  31. the Information servers with the description of this particular entry. The
  32. title line can also allow you to nest into sub-directories easily. This allows
  33. sub-menus very painlessly.
  34.  
  35. The title line can start with preceeding spaces or tabs (they are ignored).
  36. This allows you to center the line, since this is the first line displayed
  37. to the user. The rest of the title line will be displayed as the file's
  38. description in the Information Server menu.
  39.  
  40. The title line is also used by the TScript command that allows you to send
  41. a mail message. The title line is used as the subject of all these mail
  42. messages.
  43.  
  44. If the title line starts with a tilde (~), it expects a line of this format:
  45.  
  46.           ~ subdir description
  47.  
  48. The 'subdir' is the name of a sub-directory within that directory. This allows
  49. you to define one-line files that make nested sub-menus.
  50.  
  51. Outside of the Information Servers, the first line of the TScript file has
  52. no special significance, other than that already mentioned involving mail
  53. files.
  54.  
  55.  
  56. TSCRIPT TEXT CONTROL SEQUENCES:
  57. There are a few special character sequences, which all begin with the
  58. '~' character. All other characters pass through unchanged. The special
  59. control sequences in data lines are:
  60.  
  61.      ~~  - replaced by a single '~' character
  62.      ~n  - replaced with a newline character
  63.      ~c  - replaced by the user's callsign
  64.      ~e  - replaced by the Error variable
  65.      ~b  - replaced with a bell character
  66.      ~h  - replaced by the name of the host computer
  67.      ~d  - replaced by the current date
  68.      ~t  - replaced by the current time
  69.      ~u  - un-terminate the current line; remove ending newline character
  70.      ~l  - replaced by the elapsed time of this script, in seconds
  71.      ~p  - replaced with the file position of the current data file
  72.      ~0  - replaced by variable string 0
  73.      ..    ............................. through
  74.      ~9  - replaced by variable string 9
  75.      ~i0 = replaced by value of index 0
  76.      ..    ............................. through
  77.      ~i9 = replaced by value of index 9
  78.  
  79.  
  80. TSCRIPT CONTROL LINES:
  81. All lines that begin with a '~' are treated as control lines by the TScript
  82. language. These special control lines are:
  83.  
  84.      ~<space>        defines a comment line; not printed or acted upon
  85.      ~b num*         output 'num' blank lines.
  86.      ~x              exit the script at this point. (Actually goes to
  87.                      label 'exit', if it exists).
  88.      ~m              prompt the user with "---MORE (*y/n)---". The script
  89.                      then waits for the user's response. If it is anything
  90.                      other than 'no' (or 'n'), the script continues. If
  91.                      it is a 'n' response, the script ends. (see note
  92.                      in '~x')
  93.      ~l label        define a named label at this point in the script
  94.                      file, named 'label'.
  95.      ~q prompt       query the user with the string 'prompt' and '(*y/n)'.
  96.                      If the user responds with anything other than 'no'
  97.                      (or 'n'), the query status is set to 'y' (yes). This
  98.                      status is used by the "~y" and "~n" control lines.
  99.      ~y label        if the query status is set to 'yes' by a "~q" or "~c"
  100.                      control line, then goto the label line named 'label'
  101.                      and continue with the script. The named label can
  102.                      be anywhere in the script file.
  103.      ~n label        if the query status is set to 'no' by a "~q" or "~c"
  104.                      control line, then goto the label line named 'label'
  105.                      and continue with the script. The named label can
  106.                      be anywhere in the script file.
  107.      ~g label        goto the label line named 'label' and continue with
  108.                      the script. The named label can be anywhere in the
  109.                      script file.
  110.      ~v num prompt   send user 'prompt' string, get response from user,
  111.                      and assign the response to variable string 'num'.
  112.      ~a num str      assign variable string 'num' with the string 'str'.
  113.                      'str' can also be any single special character sequence.
  114.      ~ap to from     appends a string variable, 'from', to the end of another
  115.                      'to'.
  116.      ~p to fm s* l*  picks out a sub-string of a variable string 'fm' and
  117.                      places it in variable string 'to'. The sub-string starts
  118.                      at position 's' (0 is the first position). The sub-
  119.                      string will be 'l' characters long, maximum.
  120.      ~c n1 n2 [lab]  compares two variable strings (n1 & n2). This
  121.                      sets query status to 'y' if equal, 'n' if not, for use
  122.                      with the "~y" and "~n" control lines. If the optional
  123.                      label 'lab' is given and the two strings are equal,
  124.                      then goto the label 'lab'. The named label can be
  125.                      anywhere in the script file.
  126.      ~j n1 n2 l* [b] compares first 'l' characters of two variable strings
  127.                      (n1 & n2). This sets query status to 'y' if equal,
  128.                      'n' if not, for use with the "~y" and "~n" control
  129.                      lines. If the optional label 'b' is given and the
  130.                      two strings are equal, then goto the label 'b'. The
  131.                      named label can be anywhere in the script file.
  132.      ~t num index    truncates (chops off) variable string number 'num' at
  133.                      position 'index' (0 is the first position). Also, 'index'
  134.                      can be a Text Control Sequence integer variable ("~i1").
  135.      ~i#=[val*]      assign i# the value 'val' (or 1, if no 'val'). The '#'
  136.                      is i0-i9. The 'val' is either a constant or a "~i#".
  137.      ~i#+[val*]      add the value 'val' (or 1, if no 'val') to i#. The '#'
  138.                      is i0-i9. The 'val' is either a constant or a "~i#".
  139.      ~i#-[val*]      subtract the value 'val' (or 1, if no 'val') from i#. The
  140.                      '#' is i0-i9. The 'val' is either a constant or a "~i#".
  141.      ~i#?[val*][lab] compare the value 'val' (or 1, if no 'val') to the value
  142.                      of i#. The '#' is i0-i9. This command sets the query
  143.                      status for use with the "~y" and "~n" control lines.
  144.                      If the optional label 'lab' is given and the query status
  145.                      is 'y', then goto the label 'lab'. The named label can
  146.                      be anywhere in the script file.
  147.                      ** NOTE: in any of the "~i" commands, the 'val' can be
  148.                         the "~p" Text Control Sequence.
  149.      ~z var index    gets the length of variable string 'var' and places the
  150.                      length in index counter number 'index'
  151.      ~f [filename]   close any open io file and then create a new io file
  152.                      named 'filename'. To close the current io file, give no
  153.                      'filename'. The query status is set to 'y' if the file
  154.                      open was successful. Also, 'filename' can be one of the
  155.                      Text Control Sequence string variables (~0-~9).
  156.      ~o [filename]   close any open io file and then open an old io file named
  157.                      'filename'. To close the current io file, give no
  158.                      'filename'. The query status is set to 'y' if the file
  159.                      open was successful. Also, 'filename' can be one of the
  160.                      Text Control Sequence string variables (~0-~9).
  161.      ~s              seek to beginning of current io file.
  162.      ~se             seek to end of current io file.
  163.      ~sp num         seek to the position held in integer variable 'num'.
  164.      ~w textline     write the 'textline' to the current io file. The same
  165.                      special characters that apply to Text Lines apply to
  166.                      this 'textline', i.e. you can use the same control
  167.                      sequences.
  168.      ~r num          read the next line in the current io file into the
  169.                      variable string number 'num'.
  170.      ~e [lab]        test for an end-of-file condition on the current io
  171.                      file. This command sets the query status for use with
  172.                      the "~y" and "~n" control lines. If the optional label
  173.                      'lab' is given and the io file is at the end-of-file,
  174.                      then goto the label 'lab'. The named label can be
  175.                      anywhere in the script file.
  176.      ~u filename     uploads (sends a text file named 'filename' at this
  177.                      point in the script. The file MUST be ONLY ASCII text.
  178.                      Any control lines in the upload file will be only
  179.                      displayed. The script will continue, after sending
  180.                      the file, with the next line in the script file.
  181.      ~k filename     kills (deletes) a file.
  182.      ~d user file    delivers (mails) to 'user'. The subject of the message
  183.                      will be the title line of the current script. The
  184.                      message is sent from the MAILER-DAEMON. The content of
  185.                      the mail message will be the contents of the 'file'.
  186.                      The query status is set to 'y' if the message was
  187.                      successfully queued.
  188.      ~dr replyto user file  delivers (mails) to 'user'. The subject of
  189.                      the message will be the title line of the current
  190.                      script. The message is sent from the MAILER-DAEMON.
  191.                      There is a 'Reply-to:' field added to the message,
  192.                      with 'replyto' as the recepient. The content of the
  193.                      mail message will be the contents of the 'file'. The
  194.                      query status is set to 'y' if the message was
  195.                      successfully queued.
  196.      ~~ textline     a control line beginning with '~~' is treated as a text
  197.                      line with a '~~' control sequence at the beginning.
  198.      ~? option       a control line beginning with '~*' is treated as a
  199.                      request for information about 'option'. The query status
  200.                      is set to 'y' (yes) or 'n' (no). This status is used
  201.                      by the "~y" and "~n" control lines.
  202.                        Options available:
  203.                                C      ANSI color graphics permitted
  204.                                I      Connect was TCP/IP type
  205.      ~! option       a control line beginning with '~!' is treated as a
  206.                      request to change information about 'option'. The
  207.                      status of the option is toggled on/off.
  208.                        Options available:
  209.                                C      ANSI color graphics permitted
  210.      ~* status       begins or ends a ANSI color block. The 'status'
  211.                      parameter is either 'begin' or 'end'. ANSI sequences
  212.                      are "eaten" unless they are permitted for this user.
  213.      ~% colorfile    displays a color file, if ANSI color graphics is
  214.                      permitted for this user. The query status is set
  215.                      to 'y' (yes) or 'n' (no) depending on whether or not
  216.                      the user permits ANSI. This status is used by the
  217.                      "~y" and "~n" control lines.
  218.      ~@ colorcode    changes current color set to "colorcode", if ANSI color
  219.                      graphics is permitted for this user.
  220.      ~$ filename     executes the script named 'filename'. After the script
  221.                      is complete, control returns to the calling script.
  222.                      The query status is set to 'y' if the script was
  223.                      found.
  224.      ~$$ filename    same as ~$ above, except that the script is executed
  225.                      in the background, and there is no delay waiting for the
  226.                      script to complete.
  227.      ~h n1 n2 i [lb] searches string n1 for the substring n2. This
  228.                      sets query status to 'y' if found, 'n' if not, for use
  229.                      with the "~y" and "~n" control lines. The index
  230.                      variable 'i' is set to offset into n1 that n2 was
  231.                      found, or 0 if not found. If the optional
  232.                      label 'lb' is given and the substring is found,
  233.                      then goto the label 'lb'. The named label can be
  234.                      anywhere in the script file.
  235.      ~( n cstring    opens a connection on stream number 'n' (1-9). The
  236.                      connection is defined by 'cstring', which is in the form
  237.                      of a TNOS 'connect' or 'telnet' command. The current
  238.                      connection stream is NOT changed by this command.
  239.                      This sets query status to 'y' if the connection is made,
  240.                      'n' if not, for use with the "~y" and "~n" control lines.
  241.                      If the connection is NOT made, the Error variable will
  242.                      contain the reason.
  243.      ~) n            disconnects the connection on stream number 'n' (1-9).
  244.                      This sets query status to 'y' if the disconnect is made,
  245.                      'n' if not, for use with the "~y" and "~n" control lines.
  246.                      If the disconnect is NOT made, the Error variable will
  247.                      contain the reason. If 'n' is the current stream, the
  248.                      stream is reset to stream 0, the user's stream.
  249.      ~# n            changes the current I/O stream to that of stream 'n'
  250.                      (1-9). Stream 0 is the user's interactive I/O stream.
  251.      ~= n            checks the state of I/O stream 'n' (1-9), and set the
  252.                      query status to 'y' if the connection is still valid, and
  253.                      'n' if the connection is invalid or terminated.
  254.  
  255. * Parameters marked with an astrick (*) can be either a literal number
  256.   an index counter (~i0 - ~i9), or an variable string (~0 - ~9)
  257.  
  258.  
  259. Updated November 13, 1994
  260.